package com.luojialong.model.vo.projectTb;

import com.luojialong.model.domain.ProjectTb;
import com.luojialong.utils.TimeUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;


@AllArgsConstructor
@NoArgsConstructor
@Data
public class ProjectTbPageVo implements Serializable {

    private static final long serialVersionUID = -3951035825736434913L;
    /**
     * 这个项目的id
     */
    private Long id;

    /**
     * 这个项目的题目
     */
    private String title;

    /**
     * 所属分类
     */
    private String category;

    /**
     * 所属课程
     */
    private String lesson;

    /**
     * 提交时间
     */
    private String createTime;

    /**
     * 是否打分(0-代表已经打分,1-代表没有打分)
     */
    private String isStore;

    /**
     * 参赛老师的Id
     */
    private Long teacherId;

    /**
     * 老师的姓名username
     */
    private String teachName;


    public static ProjectTbPageVo transferVo(ProjectTb projectTb) {
        if (projectTb == null) {
            return null;
        }
        ProjectTbPageVo projectTbPageVo = new ProjectTbPageVo();
        BeanUtils.copyProperties(projectTb, projectTbPageVo);
        projectTbPageVo.setCreateTime(TimeUtils.transferDateFormat(projectTb.getCreateTime()));
        projectTbPageVo.setIsStore(projectTb.getIsStore() == 1 ? "已打分" : "未打分");
        return projectTbPageVo;
    }
}
